#ifndef APPLICATION_H_
#define APPLICATION_H_

#include <iostream>

#include "../SDLtoolkit/Event.h"
#include "../SDLtoolkit/SDLWrapper.h"
#include "../SDLtoolkit/Window.h"
#include "WindowHelper.h"
#include "../common/Constantes.h"
#include "../SDLtoolkit/Widget.h"
#include "../SDLtoolkit/Surface.h"
#include "../SDLtoolkit/Event.h"
#include "exception"
#include "../Server/Servidor.h"
#include "../SDLtoolkit/Timer.h"
#include "../common/Cliente/Client.h"
#include "../common/Translator/Translator.h"

#define SERVER_MAX_QUEUE 10
#define MAIN_SCENARIO "green"

class Application : public Thread{
public:

	Application();
	virtual ~Application();

private:
	virtual void* run();
	void terminar();

	void initializeSDL();
	void switchActiveWindow(WindowID id , std::string param);

	SDLWrapper* engine;
	Window* activeWindow;

	void handleUserEvent(Event& event);

	void translate(DTO* dto);

	//Se utiliza solo si se crea el servidor.
	Servidor* server;

	//Solo para el cliente si es que hay
	Client* cliente;

	bool conectado;

	SpaceBattleInterface* game;

};

#endif /* Application_H_ */
